<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //边界符 ^ $
        var rg = /abc/;
        console.log(rg.test('abc'));
        console.log(rg.test('abcd'));
        console.log(rg.test('aabcd'));
        console.log('--------------------------------');
        var reg = /^abc/;
        console.log(reg.test('abc'));
        console.log(reg.test('abcd'));
        console.log(reg.test('aabcd'));
        console.log('--------------------------------');
        var reg1 = /^abc$/;
        console.log(reg.test('abc'));
        console.log(reg.test('abcd'));
        console.log(reg.test('aabcd'));
        console.log(reg.test('abcabc'));


    </script>
</body>
</html>